<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>页面的公共头部</title>
    <link rel="stylesheet" type="text/css" href="${bp}/static/css/index.css">
    <script type="text/javascript" src="${bp}/static/js/jquery-1.11.1.js"></script>
</head>
<body>
<div id="header">
    <h4 id="left">欢迎使用XXX信息管理系统 今天是: <span id="date"></span> </h4>
    <p id="right">
        <a href="upload.jsp"><img src="${bp}/user?method=download&img=${user.img}" alt="头像"></a>
        <span>${user.username}</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <a href="${bp}/user?method=logout">logout</a>
    </p>
</div>

<script>
    setInterval(function () {

        let date = new Date();
        let year = date.getFullYear();
        let month = date.getMonth()+1;
        let day = date.getDate();

        let hour = date.getHours();
        let minutes =  date.getMinutes()<10?"0"+date.getMinutes():date.getMinutes();
        let seconds = date.getSeconds()<10?"0"+date.getSeconds():date.getSeconds();

        let weekDay = date.getDay();
        let weekArray = ["星期天","星期一","星期二","星期三","星期四","星期五","星期六"]

        let dt = year+"年"+month+"月"+day+"日" +"  "+hour+":"+minutes+":"+seconds+"  "+weekArray[weekDay]

        $("#date").text(dt)

    },10)
</script>
</body>
</html>
